﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Job.Core;
using Job.Core.Module;

namespace Job.Core
{
    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    public class BaseInstanceDAL<TKey, TModel> : BaseDAL<TKey, TModel>
        where TModel : Business<TKey, TModel>, new()
        where TKey : IComparable
    {
        private static BaseInstanceDAL<TKey, TModel> _this;
        private static object _lockthis = new object();

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static BaseInstanceDAL<TKey, TModel> Instance()
        {
            if (_this == null)
            {
                lock (_lockthis)
                {
                    if (_this == null)
                    {
                        _this = new BaseInstanceDAL<TKey, TModel>();
                    }
                }
            }
            return _this;
        }

    }




    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    public class BaseInstanceSqlDAL<TKey, TModel> : BaseSqlDAL<TKey, TModel>
        where TModel : BusinessSql<TKey, TModel>, new()
        where TKey : IComparable
    {
        private static BaseInstanceSqlDAL<TKey, TModel> _this;
        private static object _lockthis = new object();

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static BaseInstanceSqlDAL<TKey, TModel> Instance()
        {
            if (_this == null)
            {
                lock (_lockthis)
                {
                    if (_this == null)
                    {
                        _this = new BaseInstanceSqlDAL<TKey, TModel>();
                    }
                }
            }
            return _this;
        }

    }

}
